﻿<%@ Page Title="" Language="C#" MasterPageFile="~/BasicBase/BasicBase.master" AutoEventWireup="true"
    CodeFile="VehicleList.aspx.cs" Inherits="BasicBase_Vehicle_VehicleList" StylesheetTheme="Content" %>

<%@ Register Src="../../UserContral/ListPageContral.ascx" TagName="ListPageContral"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script type="text/javascript">
        //<![CDATA][
        function CheckAll(oCheckbox) {
            var items = document.getElementsByTagName("INPUT");
            for (i = 0; i < items.length; i++) {
                if (items[i].type == "checkbox") {
                    items[i].checked = oCheckbox.checked;
                }
            }
        }
        function OpenWin(url) {
            var h = 480;
            var w = 640;
            var t = (screen.height - h) / 2;
            var l = (screen.width - w) / 2;
            window.open(url, null, 'left=' + l + ",top=" + t + ",width=" + w + ",height=" + h + ",toolbar=yes,scrollbars=yes,status=yes");
        }
        //]]>
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Panel runat="server" ID="top">
        <ul class="topmenu">
            <li>单位：
                <asp:DropDownList ID="DepartmentList" runat="server" AutoPostBack="True" DataTextField="ShortName"
                    DataValueField="DepartmentID" OnTextChanged="DepartmentList_TextChanged" AppendDataBoundItems="True">
                    <asp:ListItem Value="" Text="--单位--"></asp:ListItem>
                </asp:DropDownList>
                <asp:DropDownList ID="UnitList" runat="server" DataTextField="FullName" DataValueField="DepartmentID"
                    AppendDataBoundItems="True" AutoPostBack="True" OnSelectedIndexChanged="UnitList_SelectedIndexChanged">
                </asp:DropDownList>
                类别：<asp:DropDownList ID="ddlType" runat="server" AutoPostBack="True" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlType_SelectedIndexChanged">
                    <asp:ListItem Value="">---类型---</asp:ListItem>
                </asp:DropDownList>
                <asp:DropDownList ID="ddlClass" runat="server" OnSelectedIndexChanged="ddlClass_SelectedIndexChanged"
                    AutoPostBack="True" AppendDataBoundItems="True">
                </asp:DropDownList>
            </li>
        </ul>
        <ul class=" topmenu">
            <li><a href="VehicleNew.aspx">添加</a></li>
            <li>
                <asp:LinkButton ID="ButtonEdit" runat="server" OnClick="ButtonEdit_Click">编辑</asp:LinkButton></li>
            <li>
                <asp:LinkButton ID="ButtonDelete" runat="server" OnClick="ButtonDelete_Click" OnClientClick="return confirm('是否真的删除所选记录?')">删除</asp:LinkButton></li>
            <li>
                <asp:LinkButton ID="ButtonDevices" runat="server" OnClick="ButtonDevices_Click">随车器材</asp:LinkButton></li>
            <li>
                <asp:LinkButton ID="ButtonAttachment" runat="server" OnClick="ButtonAttachment_Click">附件管理</asp:LinkButton></li>
            <li>
                <asp:LinkButton runat="server" ID="Record" Text="操作记录" OnClick="Record_Click"></asp:LinkButton>
            </li>
        </ul>
    </asp:Panel>
    <asp:GridView ID="UserGrid" runat="server" AutoGenerateColumns="False" Caption="<span>车辆列表</span>"
        DataKeyNames="VehicleID" OnRowDataBound="UserGrid_RowDataBound">
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <input id="ChkAll" type="checkbox" onclick="CheckAll(this)" runat="server" title="全选/取消" />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckItem" runat="server" />
                </ItemTemplate>
                <HeaderStyle Width="20px" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemStyle HorizontalAlign="Center" />
                <HeaderStyle Width="30px" />
                <ItemTemplate>
                    <asp:Label ID="ID" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="车辆名称">
                <ItemTemplate>
                    <a href="javascript:OpenWin('VehicleView.aspx?ID=<%# Eval("VehicleID") %>');">
                        <%# Eval("VehicleName") %></a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="车牌">
                <ItemTemplate>
                    <%# Eval("NumberPlate")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="类型">
                <ItemTemplate>
                    <%# GetType(Eval("VehicleClass").ToString())%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="类别">
                <ItemTemplate>
                    <%# GetCodeItem("XFZBLB", Eval("VehicleClass").ToString())%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="所属单位">
                <ItemTemplate>
                    <%#  GetDepartmentName(Eval("DepartmentID").ToString()) %>
                </ItemTemplate>
            </asp:TemplateField>
            <%-- <asp:TemplateField HeaderText="状态">
                <ItemTemplate>
                    <%# GetCodeItem("XFCLZT", Eval("State").ToString())%>
                </ItemTemplate>
            </asp:TemplateField>--%>
        </Columns>
        <HeaderStyle HorizontalAlign="Left" />
    </asp:GridView>
    <uc1:ListPageContral ID="ListPageContral1" OnPageSizeChange="ListPageContral1_PageSizeChange"
        PageSize="20" runat="server" />
    <div class="prompt">
        <br />
        <asp:Label ID="Prompt" runat="server"></asp:Label>
    </div>
    <asp:Label runat="server" ID="lblWhere" Visible="False"></asp:Label>
</asp:Content>
